package ModelLayer;
import java.util.ArrayList;

/**
 * Write a description of class DVD here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class DVD
{
    private int id;
    private String title;
    private String artist;
    private String releaseDate;
    private ArrayList<Specimen> specimens;

    public DVD(int id, String title, String artist, String releaseDate)
    {
        this.id = id;
        this.title = title;
        this.artist = artist;
        this.releaseDate = releaseDate;
        specimens = new ArrayList<Specimen>();
    }
    
    public int getId()
    {
        return id;
    }
    
    public String getTitel()
    {
        return title;
    }
    
    public String getArtist()
    {
        return artist;
    }
    
    public String getReleaseDate()
    {
        return releaseDate;
    }
    
    public void setTitel(String newTitel)
    {
        title = newTitel;
    }
    
    public void setArtist(String newArtist)
    {
        artist = newArtist;
    }
    
    public void setReleaseDate(String newReleaseDate)
    {
        releaseDate = newReleaseDate;
    }
    public void createCopy(Specimen specimen)
    {
            specimens.add(specimen);
    }    
    
    public Specimen getSpecimen(int specimenId)
    {
        Specimen specimen = null;
        int index = 0;
        boolean found = false;        
        while(index < specimens.size() && !found)
        {
            if(specimens.get(index).getSerialNr() == specimenId)
            {
                found = true;
                specimen = specimens.get(index);
            }
            else
            {
                index++;
            }
        }
        return specimen;
    }
}